// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import Client from '@api/visitor/api/VisitorRecordApi'

import ComClass from '@api/ComQuery'
import ListClass from '@api/visitor/model/QueryVisitorRecordListReq'
import BaseClass from '@api/visitor/model/VisitorRecordDto'

const CLIENT = CORE.grpcCLIENT(Client)
const COM = [ComClass, 'comQuery']
const BASE = [BaseClass, 'visitorRecordDto']

// ============================== 导出远程接口 ============================== //

export default {
  // —————————————————————————————— 列表 —————————————————————————————— //

  async getList(param, TIP = '查询列表') {
    const DTO = CORE.grpcDTO(ListClass, param, COM, BASE)
    const resp = await CORE.grpc(TIP, CLIENT, 'queryVisitorRecordList', DTO)
    return [resp.comQuery.totalCount, resp.visitorRecordDto || []]
  },
  transList(arr) {
    arr.forEach((item) => {
      if (item.signInTime) {
        item.status = 1
        item.bodyTemperature = '36.5℃'
      }
    })
    return arr
  },
}
